package org.easyx.ui.controller;

import javax.servlet.http.HttpServletRequest;

import org.easyx.ui.base.BossEasyUISessionUser;
import org.easyx.ui.util.SessionKit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/framework")
public class EasyuiController {
	private Logger log = LoggerFactory.getLogger(getClass());
	
	/**
	 * 在线用户页面
	 * @return
	 */
	@RequestMapping("/onlineUserPage")
    public String onlineUserPage(HttpServletRequest request,Model model){
		BossEasyUISessionUser su = SessionKit.getSessionUser(request);
		model.addAttribute("currentUser", su);
		
    	return "sys/onlineUser";
    }
	
	@RequestMapping("/noSession")
    public String noSession(){
    	return "framework/noSession";
    }
    
	/**
     * 首页
     */
    @RequestMapping(value = "/")
    public String index() {
        return "redirect:framework/index";
    }

    /**
     * 首页
     */
    @RequestMapping(value = "/index")
    public String index(HttpServletRequest request,Model model) {
    	BossEasyUISessionUser user = SessionKit.getSessionUser(request);
    	model.addAttribute("user", user);
    	
    	log.debug("进入后台首页!");
        return "framework/easyuiHome";
    }
    
    @RequestMapping("/right")
    public String right(){
    	return "framework/easyuiRight";
    }
    
    @RequestMapping(value = "/top")
    public String top(HttpServletRequest request,Model model) {
    	BossEasyUISessionUser user = SessionKit.getSessionUser(request);
    	model.addAttribute("user", user);
        return "framework/easyuiTop";
    }
    
    @RequestMapping(value = "/main")
    public String main(HttpServletRequest request,Model model) {
    	BossEasyUISessionUser user = SessionKit.getSessionUser(request);
    	model.addAttribute("user", user);
        return "framework/easyuiMain";
    }
    
    @RequestMapping(value = "/portalAbout")
    public String portalAbout(HttpServletRequest request,Model model) {
    	BossEasyUISessionUser user = SessionKit.getSessionUser(request);
    	model.addAttribute("user", user);
        return "framework/portal/about";
    }
    
    @RequestMapping(value = "/portalLink")
    public String portalLink(HttpServletRequest request,Model model) {
    	BossEasyUISessionUser user = SessionKit.getSessionUser(request);
    	model.addAttribute("user", user);
        return "framework/portal/link";
    }
    
    @RequestMapping(value = "/portalLuffy")
    public String portalLuffy(HttpServletRequest request,Model model) {
    	BossEasyUISessionUser user = SessionKit.getSessionUser(request);
    	model.addAttribute("user", user);
        return "framework/portal/luffy";
    }
    
    @RequestMapping(value = "/portalSeq")
    public String portalSeq(HttpServletRequest request,Model model) {
    	BossEasyUISessionUser user = SessionKit.getSessionUser(request);
    	model.addAttribute("user", user);
        return "framework/portal/seq";
    }
    
    @RequestMapping(value = "/unauth")
    public String unauth(HttpServletRequest request,Model model) {
    	BossEasyUISessionUser user = SessionKit.getSessionUser(request);
    	model.addAttribute("user", user);
        return "framework/unAuth";
    }
}
